<template>
    <div>
        <div style=" width: 95%;display: flex;justify-content: space-between">
            <p>{{dtl.Name}}</p>
            <div>
                <el-button type="primary" icon="el-icon-plus" size="mini" @click="AddRow">添加</el-button>
                <el-button type="success" icon="el-icon-check" size="mini" @click="SaveAll">保存</el-button>
                <el-button v-if="mapDtl.ImpModel" type="success" icon="el-icon-check" size="mini" @click="ImpDtl">导入</el-button>
                <el-button v-if="mapDtl.IsImp" type="success" icon="el-icon-check" size="mini" @click="ExpDtl">导出</el-button>
            </div>
        </div>

        <el-table :data="dtlData"
                  style="width:95%"
                  border
                  stripe
                  :height="height">
            <el-table-column
                    type="index"
                    label="#"
                    width="50">
            </el-table-column>
            <template v-for="(mapAttr,index) in dtlMapAttrs">
                <el-table-column
                        v-if="mapAttr.UIVisible!=0"
                        :key="index"
                        :prop="mapAttr.KeyOfEn"
                        :headerAlign="'center'"
                        :label="mapAttr.Name"
                        :width="mapAttr.UIWidth"
                        :fixed="mapAttr.fixed"
                        show-overflow-tooltip>
                    <template slot-scope="scope">
                        <template v-if="mapAttr.type === 'btn'" >
                            <el-link v-if="mapDtl.IsEnableLink==1" type="primary" :underline="false"  @click="OpenLink(scope.row)">{{mapDtl.LinkLabel}}</el-link>
                            <el-button v-if="scope.$index.OID!=0 && mapDtl.IsEnableAthM==1"  @click="OpenDtlAth(scope.row)" type="text" size="small">附件</el-button>
                            <el-button v-if="(mapDtl.IsDelete ===1 || mapDtl.IsInsert==1)&&scope.row.OID!=0 &&readonly==0"   @click="DeleteRow(scope.row,scope.$index)" type="text" size="small">删除</el-button>
                            <el-button v-if="(mapDtl.IsDelete ===1 || mapDtl.IsInsert==1)&&scope.row.OID===0 &&readonly==0"   @click="RemoveRow(scope.$index)" type="text" size="small">移除</el-button>
                        </template>
                        <MapAttr v-else :rowData="scope.row" :mapAttr="mapAttr" :mapAttrs="dtlMapAttrs" :frmData="dtlMainData" :rules="rules" :readonly="readonly" ></MapAttr>

                    </template>
                </el-table-column>
            </template>

        </el-table>
    </div>
</template>

<script>
    import MapAttr from "../components/mapAttr.vue"
    import {sendThis,GetDataTableOfTBChoice,GetCommPopData,GetDataTableByDB,GetFrmEleDBsByKeyOfEn} from '@/api/MapExt.js';
    export default {
        name: "dtl",
        props: {
            dtl: Object,
            refPKVal: String,
            readonly: Number,
            FK_MapData:String
        },
        components:{
            MapAttr
        },
        data(){
            return{
                params:{}, //参数
                webUser:{},
                height:"250",
                dtlData:[], //从表数据集合
                mapDtl:{},//从表属性
                dtlMainData:{},//从表信息集合
                dtlMapAttrs:[],
                rules:{},//表单字段校验规则 必填，正则表达式
                dtlOptions:{},
            }
        },
        created(){
            // 发送this 到 js 文件里
            sendThis(this);
            this.webUser= this.$store.getters.getWebUser;
            this.params = this.$store.getters.getData;
            this.loadData(); //获取基础数据
            //this.ParseTableHeader();//解析从表头部显示
            this.GetParseMapAttr(); //解析从表字段属性

            //如果mapExt是级联或者搜索多选
            let mapExts = this.dtlMainData.Sys_MapExt.filter(mapExt=>{
                return mapExt.ExtType=='ActiveDDL'
            });
            let _this = this;
            this.dtlData.forEach(row=>{
                for(let key in _this.dtlOptions){
                    _this.$set(row,key+"Options", _this.dtlOptions[key]);
                }

                if(mapExts.length!=0){
                    mapExts.forEach(mapExt=>{
                        let childKey = mapExt.AttrsOfActive;
                        _this.$set(row,childKey+"Options", _this.SelectChange(row[mapExt.AttrOfOper],mapExt));
                    })
                }
            })
            //增加操作按钮
            this.dtlMapAttrs.push({
                KeyOfEn:"Opr",
                Name:"操作",
                UIWidth:'120',
                fixed:"right",
                type:'btn'
            })

        },
        methods: {
            loadData(){
                let handler = new this.HttpHandler("BP.WF.HttpHandler.WF_CCForm");
                handler.AddJson(this.params);
                handler.AddPara("EnsName",this.dtl.No);
                let data = handler.DoMethodReturnString("Dtl_Init");
                // 检查是否有错误.
                if (data.indexOf('err@') == 0) {
                    this.$alert(data);
                    return;
                }
                //解析.
                data = JSON.parse(data);
                this.dtlMainData = data;
                //从表信息.
                this.mapDtl = data["Sys_MapDtl"][0]; //从表描述.
                this.dtlData = data["DBDtl"]; //从表数据.
            },
            SelectChange(selectVal,mapExt){
                if (selectVal == "" || selectVal == "all") {
                    return [];
                }
                let dataObj = GetDataTableByDB(mapExt.Doc, mapExt.DBType, mapExt.FK_DBSrc, selectVal);
                if (dataObj == null || dataObj.length == 0){
                    return [];
                }
                return dataObj;
            },
            /**
             * 分析字段类型和扩展属性的解析
             * @constructor
             */
            GetParseMapAttr:function(){
                let mapExts = this.GetMapExtsGroup();
                let _this = this;
                this.dtlMapAttrs=this.dtlMainData.Sys_MapAttr;
                /*this.dtlMapAttrs = this.dtlMainData.Sys_MapAttr.filter(mapAttr=>{
                    return mapAttr.UIVisible!=0;
                });*/
                let attrRules=[];
                this.$.each(this.dtlMapAttrs,function(i,mapAttr){
                    attrRules=[];
                    if(_this.isReadOnlyExt ==1)
                        mapAttr.UIIsEnable = 0;
                    if(mapAttr.UIIsInput==1)
                        attrRules.push({
                            required: true,
                            message: '请输入'+mapAttr.Name,
                            trigger: 'blur'
                        })

                    if(mapExts[mapAttr.MyPK]!= undefined && mapExts[mapAttr.MyPK].length != 0)
                        mapAttr.MapExts = mapExts[mapAttr.MyPK];
                    else
                        mapAttr.MapExts=[];
                    //分析字段所属的类型
                    let AtPara = mapAttr.AtPara;
                    let isEnableJS = AtPara == "" || AtPara == null || AtPara == undefined || AtPara.indexOf('@IsEnableJS=1') == -1 ? false : true;
                    //外键或者外部数据源
                    if((mapAttr.LGType == "0" && mapAttr.MyDataType == "1" && mapAttr.UIContralType == 1)
                        || (mapAttr.LGType == "2" && mapAttr.MyDataType == "1")){
                        mapAttr.DataType="DDL";
                        mapAttr.type="select";
                        //增加下拉框
                        _this.dtlOptions[mapAttr.KeyOfEn]=_this.InitDDLData(mapAttr);
                        //mapAttr.Options = _this.InitDDLData(mapAttr);
                        mapAttr.IsEnableJs = isEnableJS;
                        if(mapAttr.LGType==0)
                            mapAttr.BindKeyType=1;
                        else
                            mapAttr.BindKeyType = 0;
                        return true;
                    }
                    //枚举类型
                    let attrdefVal="";
                    if(mapAttr.LGType == 1){
                        if(mapAttr.UIContralType == 1){
                            mapAttr.DataType="DDL";
                            mapAttr.type="select";
                            //mapAttr.Options = _this.InitDDLData(mapAttr);
                            _this.dtlOptions[mapAttr.KeyOfEn]=_this.InitDDLData(mapAttr);
                            mapAttr.IsEnableJs = isEnableJS;
                        }
                        if(mapAttr.UIContralType == 2){ //枚举复选框多选
                            mapAttr.DataType="CheckBox";
                            mapAttr.type="checkboxs";
                            _this.dtlOptions[mapAttr.KeyOfEn]=_this.InitDDLData(mapAttr);
                           // mapAttr.Options = _this.InitDDLData(mapAttr);
                        }
                        if(mapAttr.UIContralType == 3){ //担心按钮
                            mapAttr.DataType="Radio";
                            mapAttr.type="radio";
                            _this.dtlOptions[mapAttr.KeyOfEn]=_this.InitDDLData(mapAttr);
                            //mapAttr.Options = _this.InitDDLData(mapAttr);
                            mapAttr.IsEnableJs = isEnableJS;
                        }
                        return true;
                    }
                    mapAttr.DataType="Input";
                    if (mapAttr.LGType == 0) {
                        switch (parseInt(mapAttr.MyDataType)) {
                            case 1://普通文本
                                switch (parseInt(mapAttr.UIContralType)) {
                                    case 4: //地图
                                        mapAttr.type = "Map";
                                        break;
                                    case 6://字段附件
                                        mapAttr.type = "FieldAth";
                                        break;
                                    case 8://写字板
                                        mapAttr.type = "HandWrite";
                                        break;
                                    case 9://超链接
                                        mapAttr.type = "Link";
                                        break;
                                    case 13://身份证
                                        mapAttr.type = "IDCard";
                                        break;
                                    case 16://系统定位
                                        mapAttr.type = "Fixed";
                                        break;
                                    case 18://按钮
                                        mapAttr.type = "button";
                                        break;
                                    case 50://工作进度
                                        mapAttr.type = "JobSchedule";
                                        break;
                                    case 101://评分标准
                                        mapAttr.type = "Score";
                                        break;
                                    default:
                                        //判断是不是富文本编辑器
                                        if (mapAttr.AtPara && mapAttr.AtPara.indexOf("@IsRichText=1") >= 0) {
                                            if (mapAttr.UIIsEnable == "0" || this.isReadOnlyExt == 0) {
                                                //使用div展示
                                                mapAttr.type = "div";
                                                break;
                                            }
                                            mapAttr.type = "richText";
                                            break;
                                        }
                                        //判断是不是大块文本
                                        if (mapAttr.IsSupperText == 1 || mapAttr.UIHeight > 40) {
                                            mapAttr.type = "textarea";
                                            break;
                                        }
                                        mapAttr.type = "string";
                                        if(mapAttr.MapExts.length!=0 ){
                                            _this.$.each(mapAttr.MapExts,function(k,mapExt){
                                                if(mapAttr.UIIsEnable==0){

                                                    return true;
                                                }
                                                let PopModel = _this.GetPara(mapAttr.AtPara,"PopModel");
                                                if (PopModel != undefined && PopModel != "" && mapExt.ExtType == PopModel && PopModel != "None"){
                                                    mapAttr.type=PopModel;
                                                    let mapExt = mapAttr.MapExts[0];
                                                    //单选还是多选
                                                    let selectType = mapExt.SelectType;
                                                    selectType = selectType == null || selectType == undefined || selectType == "" ? 1 : selectType;

                                                    mapAttr.selectType = selectType==1?true:false;
                                                    if(mapAttr.type=='PopBindSFTable' || mapAttr.type=='PopBindEnum' ||mapAttr.type=='PopTableList' || mapAttr.type=='PopGroupList'){
                                                        //mapAttr.Options = GetCommPopData(mapExt,PopModel);
                                                        _this.dtlOptions[mapAttr.KeyOfEn]=GetCommPopData(mapExt,PopModel);
                                                        let  val = _this.mainData[mapAttr.KeyOfEn];
                                                        if(val!=null && val!=undefined && val!="")
                                                            _this.mainData[mapAttr.KeyOfEn]=val.split(",");
                                                    }


                                                    return true;
                                                }
                                                let TBModel = _this.GetPara(mapAttr.AtPara,"TBFullCtrl");
                                                if (TBModel != undefined && TBModel != "" && TBModel != "None" && (mapExt.ExtType == "FullData")){
                                                    mapAttr.type="tbFullCtrl";
                                                    return true;
                                                }
                                                let  val = _this.mainData[mapAttr.KeyOfEn];
                                                switch (mapExt.ExtType){
                                                    case "MultipleChoiceSmall"://小范围多选
                                                        mapAttr.type="checkBoxs";
                                                        //mapAttr.Options=GetDataTableOfTBChoice(mapExt, _this.frmData,_this.$store.getters.getWebUser);
                                                        _this.dtlOptions[mapAttr.KeyOfEn]=GetDataTableOfTBChoice(mapExt, _this.frmData,_this.$store.getters.getWebUser);
                                                        if(val!=null && val!=undefined && val!="")
                                                            _this.mainData[mapAttr.KeyOfEn]=val.split(",");
                                                        break;
                                                    case "SingleChoiceSmall"://小范围单选
                                                        mapAttr.type="radio";
                                                        //mapAttr.Options=GetDataTableOfTBChoice(mapExt, _this.frmData,_this.$store.getters.getWebUser);
                                                        _this.dtlOptions[mapAttr.KeyOfEn]= GetDataTableOfTBChoice(mapExt, _this.frmData,_this.$store.getters.getWebUser);
                                                        if(val!=null && val!=undefined && val!="")
                                                            _this.mainData[mapAttr.KeyOfEn]=val.split(",");
                                                        break;
                                                    case "MultipleChoiceSearch"://搜索多选
                                                        mapAttr.type="ChoiceSearch"
                                                        mapAttr.loading = false;
                                                        //mapAttr.Options=[];
                                                        _this.dtlOptions[mapAttr.KeyOfEn]=[];
                                                        if(val!=null && val!=undefined && val!=""){
                                                            _this.mainData[mapAttr.KeyOfEn]=val.split(",");
                                                            _this.dtlOptions[mapAttr.KeyOfEn]=GetFrmEleDBsByKeyOfEn(mapAttr.KeyOfEn,mapAttr.FK_MapData,_this.workID);
                                                        }
                                                        break;
                                                    case "MultipleInputSearch"://高级快速录入
                                                        mapAttr.type="InputSearch"
                                                        _this.dtlOptions[mapAttr.KeyOfEn]=[];
                                                        if(val!=null && val!=undefined && val!=""){
                                                            _this.mainData[mapAttr.KeyOfEn]=val.split(",");
                                                            _this.dtlOptions[mapAttr.KeyOfEn]=GetFrmEleDBsByKeyOfEn(mapAttr.KeyOfEn,mapAttr.FK_MapData,_this.workID);
                                                        }
                                                        break;
                                                    case "BindFunction"://绑定函数(现在只处理文本，其他的单独处理了)
                                                        break;
                                                    case "RegularExpression":
                                                        var filter = mapExt.Doc.replace(/【/g, '[').replace(/】/g, ']').replace(/（/g, '(').replace(/）/g, ')').replace(/｛/g, '{')
                                                        filter = filter.substr(1);
                                                        filter = filter.substr(0,filter.length-1);
                                                        attrRules.push({
                                                            pattern: filter,
                                                            message: mapExt.Tag1,
                                                            trigger: mapExt.Tag.substring(2)
                                                        })
                                                        break;
                                                    default:
                                                        alert(mapAttr.Name + "字段扩展属性" + mapExt.ExtType + "该类型还未解析，请反馈给开发人员");
                                                        break;
                                                }

                                            })
                                        }
                                        break;
                                }
                                break;
                            case 2://整数
                                mapAttr.DataType="Number";
                                mapAttr.type = "number";
                                mapAttr.precision = 0;
                                break;
                            case 4:  //复选框
                                mapAttr.DataType="CheckBox";
                                mapAttr.type = "checkbox";
                                mapAttr.IsEnableJs = isEnableJS;
                                break;
                            case 3://浮点
                            case 5://双精度
                                mapAttr.DataType="Float";
                                mapAttr.type = "float";
                                attrdefVal = mapAttr.DefVal;
                                if (attrdefVal != null && attrdefVal !== "" && attrdefVal.indexOf(".") >= 0)
                                    mapAttr.precision = attrdefVal.substring(attrdefVal.indexOf(".") + 1).length;
                                else
                                    mapAttr.precision = 2;
                                break;
                            case 6://日期类型
                            case 7://时间类型
                                mapAttr.DataType="Date";
                                switch(parseInt(mapAttr.IsSupperText)){ //获取日期格式
                                    case 0:
                                        mapAttr.dateFmt = "yyyy-MM-dd";
                                        mapAttr.type = "date";
                                        mapAttr.UIWidth= mapAttr.UIWidth<150?150:mapAttr.UIWidth;
                                        break;
                                    case 1:
                                        mapAttr.dateFmt = "yyyy-MM-dd HH:mm";
                                        mapAttr.type = "datetime";
                                        break;
                                    case 2:
                                        mapAttr.dateFmt = "yyyy-MM-dd HH:mm:ss";
                                        mapAttr.type = "datetime";
                                        break;
                                    case 3:
                                        mapAttr.dateFmt = "yyyy-MM";
                                        mapAttr.type = "date";
                                        break;
                                    case 4:
                                        mapAttr.dateFmt = "HH:mm";
                                        mapAttr.type = "time";
                                        break;
                                    case 5:
                                        mapAttr.dateFmt = "HH:mm:ss";
                                        mapAttr.type = "time";
                                        break;
                                    case 6:
                                        mapAttr.dateFmt = "MM-dd";
                                        mapAttr.type = "date";
                                        break;
                                }
                                break;
                            case 8://金额
                                mapAttr.DataType="Money";
                                mapAttr.type = "money";
                                attrdefVal = mapAttr.DefVal;
                                if (attrdefVal != null && attrdefVal !== "" && attrdefVal.indexOf(".") >= 0)
                                    mapAttr.precision = attrdefVal.substring(attrdefVal.indexOf(".") + 1).length;
                                else
                                    mapAttr.precision = 2;
                                break;
                        }
                        if(attrRules.length!=0){
                            _this.rules[mapAttr.KeyOfEn]=attrRules;
                        }
                    }
                });

            },
            InitDDLData:function(mapAttr){
                let ddlData=[];
                /*if(this.isReadOnly==1){
                    let val = this.mainData[mapAttr.KeyOfEn+"Text"];
                    if (val == null || val == undefined || val == "")
                        val = this.mainData[mapAttr.KeyOfEn + "T"];
                    ddlData.push({"No":this.mainData[mapAttr.KeyOfEn],"Name":val});
                    return ddlData;
                }*/
                let data = this.dtlMainData[mapAttr.KeyOfEn];
                if (data == undefined)
                    data = this.dtlMainData[mapAttr.UIBindKey];
                if (data == undefined) {
                    //枚举类型的.
                    if (mapAttr.LGType == 1) {
                        let enums = this.dtlMainData.Sys_Enum;
                        enums.forEach(item=>{
                            if(item.EnumKey==mapAttr.UIBindKey)
                                ddlData.push({"No":item.IntKey,"Name":item.Lab});
                        });
                    }
                }else{
                    data.forEach(item=>{
                        ddlData.push({"No":item.No,"Name":item.Name});
                    })
                }
                return ddlData;
            },
            /**
             * 扩展字段根据字段MyPK分组
             * @constructor
             */
            GetMapExtsGroup:function(){
                let map = {};
                let mypk = "";
                if(this.dtlMainData.Sys_MapExt.length==0)
                    return map;
                //对mapExt进行分组，根据AttrOfOper
                this.dtlMainData.Sys_MapExt.forEach(function(mapExt){
                    //不是操作字段不解析
                    if (mapExt.AttrOfOper == "")
                        return true;
                    if (mapExt.ExtType == "DtlImp"
                        || mapExt.MyPK.indexOf(mapExt.FK_MapData + '_Table') >= 0
                        || mapExt.MyPK.indexOf('PageLoadFull') >= 0
                        || mapExt.ExtType == 'StartFlow'
                        || mapExt.ExtType == 'AutoFullDLL'
                        || mapExt.ExtType == 'ActiveDDLSearchCond'
                        || mapExt.ExtType == 'AutoFullDLLSearchCond')
                        return true;

                    mypk = mapExt.FK_MapData + "_" + mapExt.AttrOfOper;
                    if (!map[mypk])
                        map[mypk] = [mapExt];
                    else
                        map[mypk].push(mapExt);
                })
                let res = [];
                Object.keys(map).forEach(key => {
                    res.push({
                        attrKey: key,
                        data: map[key],
                    })
                });
                return map;
            },
            /**
             * 新增加一行
             * @constructor
             */
            AddRow(){
                let newRow={};
                this.dtlMapAttrs.forEach(mapAttr=>{
                    if(mapAttr.KeyOfEn=="OID")
                        newRow["OID"]=0;
                    else if(mapAttr.DefVal!=null && mapAttr.DefVal!=""){
                        if(mapAttr.LGType == 1)
                            newRow[mapAttr.KeyOfEn]=parseInt(mapAttr.DefVal);
                        else
                            newRow[mapAttr.KeyOfEn]=mapAttr.DefVal;
                    }
                    else
                        newRow[mapAttr.KeyOfEn]="";
                });
                //如果mapExt是级联或者搜索多选
                let mapExts = this.dtlMainData.Sys_MapExt.filter(mapExt=>{
                    return mapExt.ExtType=='ActiveDDL'
                });
                let _this = this;
                for(let key in _this.dtlOptions){
                    newRow[key+'Options']=_this.dtlOptions[key];
                }

                if(mapExts.length!=0){
                    mapExts.forEach(mapExt=>{
                        let childKey = mapExt.AttrsOfActive;
                        newRow[childKey+'Options'] = _this.SelectChange(newRow[mapExt.AttrOfOper],mapExt);
                    })
                }

                this.dtlData.push(newRow);
            },
            /**
             * 保存从表信息
             * @constructor
             */
            SaveAll(){
                let _this = this;
                let flag = true;
                let handler = new this.HttpHandler("BP.WF.HttpHandler.WF_CCForm");
                this.dtlData.forEach(row=>{
                    handler.Clear();
                    handler.AddJson(_this.params);
                    handler.AddJson(row);
                    handler.AddPara("FK_MapDtl",_this.dtl.No);
                    handler.AddPara("RefPKVal",_this.refPKVal);
                    handler.AddPara("FK_MapData",_this.FK_MapData);
                    let data = handler.DoMethodReturnString("Dtl_SaveRow");
                    if(data.indexOf("err@")!=-1){
                        this.$alert("从表保存失败:"+data);
                        flag= false;
                        return;
                    }
                });
                if(flag == true)
                    this.loadData();
                return flag;
            },
            /**
             * 从表导入数据
             * @constructor
             */
            ImpDtl(){

            },
            /**
             * 从表导出
             * @constructor
             */
            ExpDtl(){

            },
            OpenLink(row){
                let linkUrl = this.mapDtl.LinkUrl;
                if (linkUrl.indexOf("?") == -1)
                    linkUrl = linkUrl + "?1=2";
                linkUrl = this.DealExp(linkUrl,row);

                if (this.mapDtl.LinkTarget == "_self" || this.mapDtl.LinkTarget == "_blank") {
                    window.location.href = linkUrl;
                    return;
                }



            },
            OpenDtlAth(){

            },
            /**
             * 删除数据
             * @param row
             * @param index
             * @constructor
             */
            DeleteRow(row,index){
                //删除数据库中的数据
                this.$confirm('您确定要删除该条数据吗 ?', '', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消'
                }).then(() => {
                    let handler = new this.HttpHandler("BP.WF.HttpHandler.WF_CCForm");
                    handler.AddPara("FK_MapDtl", this.dtl.No);
                    handler.AddPara("RefPKVal", this.refPKVal);
                    handler.AddPara("RefOID",row.OID);
                    let data = handler.DoMethodReturnString("Dtl_DeleteRow");
                    if(data.indexOf('err@')!=-1){
                        this.$message({
                            type: 'error',
                            message: data
                        });
                        console.log(data);
                    }else{
                        this.$message({
                            type: 'success',
                            message: data
                        });
                        this.RemoveRow(index);
                    }
                });

            },
            /**
             * 移除数据
             * @param index
             * @constructor
             */
            RemoveRow(index){
                this.dtlData.splice(index,1);
            },
            /**
             * 处理数据
             * @param expStr
             * @param row
             * @returns {*}
             * @constructor
             */
            DealExp(expStr,row){
                if (expStr.indexOf('@') == -1)
                    return expStr;

                //替换表达式常用的用户信息
                expStr = expStr.replace('@WebUser.No', this.webUser.No);
                expStr = expStr.replace('@WebUser.Name', this.webUser.Name);
                expStr = expStr.replace("@WebUser.FK_DeptNameOfFull", this.webUser.FK_DeptNameOfFull);
                expStr = expStr.replace('@WebUser.FK_DeptName', this.webUser.FK_DeptName);
                expStr = expStr.replace('@WebUser.FK_Dept', this.webUser.FK_Dept);
                if (expStr.indexOf('@') == -1)
                    return expStr;
                for(let key in row){
                    expStr = expStr.replace("@" + key, row[key]);
                    if (expStr.indexOf('@') == -1)
                        return expStr;
                }

                for(let key in this.params){
                    expStr = expStr.replace("@" + key, this.params[key]);
                    if (expStr.indexOf('@') == -1)
                        return expStr;
                }
                return expStr;
            },
            handleCurrentChange() {
                //console.log(row, event, column, event.currentTarget)
            },
            handleEdit(index, row) {
                console.log(index, row);
                this.$emit("handleEdit", {index: index, row: row})
            },
            onSelected:function(index,row){
                console.log(row);
                this.$emit("onTableBtn",{index: index, row: row})
            }
        }
    }
</script>

<style scoped>

</style>